"""
在创建多个线程时args和kwargs的传参方式
"""

import time
import threading


def sing(msg):
    while True:
        print(msg)
        time.sleep(1)


def dance(msg):
    while True:
        print(msg)
        time.sleep(1)


if __name__ == "__main__":
    # 创建一个唱歌的线程   给sing函数以args元组的方式传参
    sing_thread = threading.Thread(target=sing, args=("我在唱歌，啦啦啦",))
    # 创建一个跳舞的线程    给dance函数以kwargs字典的方式传参
    dance_thread = threading.Thread(target=dance, kwargs={"msg": "我在跳舞，呱呱呱"})

    # 启动多个线程  同时执行
    sing_thread.start()
    dance_thread.start()
